<?php if(!defined('GbIncl2')){?>
<meta http-equiv="refresh" content="0;url=../spm-itats/block.php" />
<?php } else { ?>
	<?php
    $_GET['set']=isset($_GET['set']) ? $_GET['set'] :'';
	$_GET['dkbt']=isset($_GET['dkbt']) ? $_GET['dkbt'] :''; 
	if ($_SESSION['DKBT']=='1'){ ?>
    <div class="section">
    <ul class="nice-list">
        <li> 
            <?php if ($_GET['dkbt']=='dikti'){ echo "<a href=?setting=dkbt&amp;dkbt=dikti>"?><b>DIKTI</b></a> |
            <?php }else{ echo "<a href=?setting=dkbt&amp;dkbt=dikti>"?>DIKTI</a> |
            <?php }?>
            <?php if ($_GET['dkbt']=='kopertis7'){ echo "<a href=?setting=dkbt&amp;dkbt=kopertis7>"?><b>KOPERTIS VII</b></a> |
            <?php }else{ echo "<a href=?setting=dkbt&amp;dkbt=kopertis7>"?>KOPERTIS VII</a> |
            <?php }?>
            <?php if ($_GET['dkbt']=='banpt'){ echo "<a href=?setting=dkbt&amp;dkbt=banpt>"?><b>BAN-PT</b></a> |
            <?php }else{ echo "<a href=?setting=dkbt&amp;dkbt=banpt>"?>BAN-PT</a> |
            <?php }?>
            <?php if ($_GET['dkbt']=='tautan'){ echo "<a href=?setting=dkbt&amp;dkbt=tautan>"?><b>TAUTAN TERKAIT</b></a>
            <?php }else{ echo "<a href=?setting=dkbt&amp;dkbt=tautan>"?>TAUTAN TERKAIT</a>
            <?php }?>
        </li>
        <?php //AWAL TAMPIL TABEL MASING MASING//?>
        <?php if ($_GET['dkbt']=='dikti'){?>
        <li>
            <table border="1">
              <tr class="even">
                <td width="5%">ID</td>
                <td width="25%">JUDUL</td>
                <td width="65%">LINK</td>
                <td width="5%">PENGATURAN</td>
              </tr>
			  <?php $DDIKTI=mysql_query("select * from DKB_SPM where ID_PARENTDS='01' ORDER BY ID_DS ASC");$CDDIKTI=mysql_query("select COUNT(*) AS CDDIKTI from DKB_SPM where ID_PARENTDS=1");$CDDIKTI=mysql_fetch_assoc($CDDIKTI);
			  while ($DATADDIKTI=mysql_fetch_array($DDIKTI)){?>
              <tr>
                <td><?php echo $DATADDIKTI['ID_DS'] ?></td>
                <td><?php echo $DATADDIKTI['NAMA_DS'] ?></td>
                <td><?php echo substr($DATADDIKTI['LINK_DS'],0,50) ?></td>
                <td>
                    <?php $elinkidd=$DATADDIKTI['ID_DS'];
                    echo "<a href=?setting=dkbt&amp;dkbt=dikti&amp;idd=$elinkidd&amp;set=02>";?>edit</a> | 
                    <?php echo "<a href=?setting=dkbt&amp;dkbt=dikti&amp;idd=$elinkidd&amp;set=03>";?> delete</a>
                </td>
              </tr> 
			  <?php } ?>
              <tr>
                <td colspan="4"><?php echo "<a href=?setting=dkbt&amp;dkbt=dikti&amp;set=01>";?>tambah data</a></td>
              </tr>
            </table>
        </li>
        
		<?php }else if ($_GET['dkbt']=='kopertis7'){?>
        <li>
            <table border="1">
              <tr class="even">
                <td width="5%">ID</td>
                <td width="25%">JUDUL</td>
                <td width="65%">LINK</td>
                <td width="5%">PENGATURAN</td>
              </tr>
			  <?php $TDIKTI=mysql_query("select * from DKB_SPM where ID_PARENTDS='02' ORDER BY ID_DS ASC"); $CKDIKTI=mysql_query("select COUNT(*) AS CKDIKTI from DKB_SPM where ID_PARENTDS=2"); $CKDIKTI=mysql_fetch_assoc($CKDIKTI); 
			  while ($DATATDIKTI=mysql_fetch_array($TDIKTI)){?>
              <tr>
                <td><?php echo $DATATDIKTI['ID_DS'] ?></th>
                <td><?php echo $DATATDIKTI['NAMA_DS'] ?></td>
                <td><?php echo substr($DATATDIKTI['LINK_DS'],0,50) ?></td>
                <td>
                    <?php $elinkidd=$DATATDIKTI['ID_DS'];
                    echo "<a href=?setting=dkbt&amp;dkbt=kopertis7&amp;idd=$elinkidd&amp;set=02>";?>edit</a> | 
                    <?php echo "<a href=?setting=dkbt&amp;dkbt=kopertis7&amp;idd=$elinkidd&amp;set=03>";?> delete</a>
                </td>
              </tr> 
			  <?php } ?>
              <tr>
                <td colspan="4"><?php echo "<a href=?setting=dkbt&amp;dkbt=kopertis7&amp;set=01>";?>tambah data</a></td>
              </tr>
               </table>
        </li>
		
		<?php }else if ($_GET['dkbt']=='banpt'){?>
        <li>
            <table border="1">
              <tr class="even">
                <td width="5%">ID</td>
                <td width="25%">JUDUL</td>
                <td width="65%">LINK</td>
                <td width="5%">PENGATURAN</td>
              </tr>
			  <?php $TDIKTI=mysql_query("select * from DKB_SPM where ID_PARENTDS='03' ORDER BY ID_DS ASC"); $CBDIKTI=mysql_query("select COUNT(*) AS CBDIKTI from DKB_SPM where ID_PARENTDS=3"); $CBDIKTI=mysql_fetch_assoc($CBDIKTI); 
			  while ($DATATDIKTI=mysql_fetch_array($TDIKTI)){?>
              <tr>
                <td><?php echo $DATATDIKTI['ID_DS'] ?></th>
                <td><?php echo $DATATDIKTI['NAMA_DS'] ?></td>
                <td><?php echo substr($DATATDIKTI['LINK_DS'],0,50) ?></td>
                <td>
                    <?php $elinkidd=$DATATDIKTI['ID_DS'];
                    echo "<a href=?setting=dkbt&amp;dkbt=banpt&amp;idd=$elinkidd&amp;set=02>";?>edit</a> | 
                    <?php echo "<a href=?setting=dkbt&amp;dkbt=banpt&amp;idd=$elinkidd&amp;set=03>";?> delete</a>
                </td>
              </tr>
			  <?php } ?>
              <tr>
                <td colspan="4"><?php echo "<a href=?setting=dkbt&amp;dkbt=banpt&amp;set=01>";?>tambah data</a></td>
              </tr>
              </table>
        </li>
		
		<?php }else if ($_GET['dkbt']=='tautan'){?>
        <li>
            <table border="1">
              <tr class="even">
                <td width="5%">ID</td>
                <td width="25%">JUDUL</td>
                <td width="65%">LINK</td>
                <td width="5%">PENGATURAN</td>
              </tr>
			  <?php $TDIKTI=mysql_query("select * from DKB_SPM where ID_PARENTDS='04' ORDER BY ID_DS ASC"); $CTDIKTI=mysql_query("select COUNT(*) AS CTDIKTI from DKB_SPM where ID_PARENTDS=4"); $CTDIKTI=mysql_fetch_assoc($CTDIKTI); 
			  while ($DATATDIKTI=mysql_fetch_array($TDIKTI)){?>
              <tr>
                <td><?php echo $DATATDIKTI['ID_DS'] ?></th>
                <td><?php echo $DATATDIKTI['NAMA_DS'] ?></td>
                <td><?php echo substr($DATATDIKTI['LINK_DS'],0,50) ?></td>
                <td>
                    <?php $elinkidd=$DATATDIKTI['ID_DS'];
                    echo "<a href=?setting=dkbt&amp;dkbt=tautan&amp;idd=$elinkidd&amp;set=02>";?>edit</a> | 
                    <?php echo "<a href=?setting=dkbt&amp;dkbt=tautan&amp;idd=$elinkidd&amp;set=03>";?> delete</a>
                </td>
              </tr>
			  <?php } ?>
              <tr>
                <td colspan="4"><?php echo "<a href=?setting=dkbt&amp;dkbt=tautan&amp;set=01>";?>tambah data</a></td>
              </tr>
              </table>
        </li>
        
        <?php } else { ?>
        	<meta http-equiv="refresh" content="0;url=../cpanel/?setting=dkbt&amp;dkbt=dikti" />
        <?php }	?>
        <?php //AKHIR TAMPIL TABEL MASING MASING//?>
        
        <?php //AWAL FORM INSERT//?>
        <?php 
        if ($_GET['set']=='01'){?>
        <form id="f_s_dkbt" name="f_s_dkbt" method="post" action="">
          <table width="100%" border="2">
            <tr>
              <th scope="row" width="10%"><label for="t_d_idp">GRUP</label></th>
              <th width="90%"><?php echo $_GET['dkbt']?></th>
            </tr>
            <tr>
              <th scope="row"><label for="t_d_id">ID</label></th>
              <th>
                <?php 
                if ($_GET['dkbt']=='dikti'){
                    echo $CDDIKTI['CDDIKTI']+1;}
                else if ($_GET['dkbt']=='kopertis7'){
                    echo $CKDIKTI['CKDIKTI']+1;}
                else if ($_GET['dkbt']=='banpt'){
                    echo $CBDIKTI['CBDIKTI']+1;}
                else if ($_GET['dkbt']=='tautan'){
                    echo $CTDIKTI['CTDIKTI']+1;}
                ?>
              </th>
            </tr>
            <tr>
              <th scope="row"><label for="t_d_judul">JUDUL(*)</label></th>
              <th><input type="text" class="text" size="27" name="t_d_judul" id="t_d_judul" /></th>
            </tr>
            <tr>
              <th scope="row"><label for="t_d_link">LINK(*)</label></th>
              <th><textarea name="t_d_link" id="t_d_link2" cols="100%" rows="5"></textarea></th>
            </tr>
            <tr>
              <th scope="row">&nbsp;</th>
              <th class="left"><input type="submit" name="submit" id="b_d_insert" class="button" value="Tambah" /></th>
            </tr>
          </table>
        </form>
        <?php //AKHIR FORM INSERT//?>
        
        <?php //AWAL DELETE//?>
        <?php }else if ($_GET['set']=='03'){
			if ($_GET['dkbt']=='dikti'){
				$idp=1;
				$idd=$_GET['idd'];
			}else if ($_GET['dkbt']=='kopertis7'){
				$idp=2;
				$idd=$_GET['idd'];
			}else if ($_GET['dkbt']=='banpt'){
				$idp=3;
				$idd=$_GET['idd'];
			}else if ($_GET['dkbt']=='tautan'){
				$idp=4;
				$idd=$_GET['idd'];
			}
			$deletedkbt = "DELETE FROM DKB_SPM WHERE ID_PARENTDS='$idp' AND ID_DS='$idd' LIMIT 1";
			$hasildeletedkbt = mysql_query($deletedkbt);
			if ($hasildeletedkbt){
				echo "<p>Proses Hapus Sukses .</p>";?>
				<meta http-equiv="refresh" content="0;url='../cpanel/?setting=dkbt&amp;dkbt=dikti'"><?php
			}else echo "<p>Proses Hapus Gagal</p>";?>
        <?php } ?>
        <?php //AKHIR DELETE//?>
        
        <?php //AWAL INSERT//?>
        <?php
        if ($_GET['set']=='01' and isset($_POST['t_d_judul']) and isset($_POST['t_d_link'])){
			echo "Data tidak boleh kosong";
		}else
		if ($_GET['set']=='01' and isset($_POST['t_d_judul']) and isset($_POST['t_d_link'])){
            if ($_GET['dkbt']=='dikti'){
                $idp=1;
                $idd=$CDDIKTI['CDDIKTI']+1;
            }else if ($_GET['dkbt']=='kopertis7'){
                $idp=2;
                $idd=$CKDIKTI['CKDIKTI']+1;
            }else if ($_GET['dkbt']=='banpt'){
                $idp=3;
                $idd=$CBDIKTI['CBDIKTI']+1;
            }else if ($_GET['dkbt']=='tautan'){
                $idp=4;
                $idd=$CTDIKTI['CTDIKTI']+1;
            }
            $insertdkbt = "INSERT INTO DKB_SPM VALUES ('$idp','$idd','$_POST[t_d_judul]','$_POST[t_d_link]')";
            $hasilinsertdkbt = mysql_query($insertdkbt);
            if ($hasilinsertdkbt){
                echo "<p>Proses Input Sukses .</p>";
                if ($_GET['dkbt']=='dikti'){?>
                    <meta http-equiv="refresh" content="0;url='../cpanel/?setting=dkbt&amp;dkbt=dikti'">
                <?php } else if ($_GET['dkbt']=='kopertis7'){?>
                    <meta http-equiv="refresh" content="0;url='../cpanel/?setting=dkbt&amp;dkbt=kopertis7'">
                <?php } else if ($_GET['dkbt']=='banpt'){?>
                    <meta http-equiv="refresh" content="0;url='../cpanel/?setting=dkbt&amp;dkbt=banpt'">
                <?php } else if ($_GET['dkbt']=='tautan'){?>
                    <meta http-equiv="refresh" content="0;url='../cpanel/?setting=dkbt&amp;dkbt=tautan'">
                <?php } ?>
            <?php }else echo "<p>Proses Input Gagal</p>";?>
        <?php }?>
        <?php //AKHIR INSERT//?>	
    </ul>
    </div>
	<?php }else {?>
    	<meta http-equiv="refresh" content="0;url=block.php" />
    <?php }?>
<?php }?>

<?php
/*

*/
?>